<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<p:dialog xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" 
	xmlns:pe="http://primefaces.org/ui/extensions"
	modal="true" width="500" height="280" resizable="false" 
	widgetVar="dialogAddPais" id="dialogFormPais" closable="false"
	appendToBody="true">

	<link type="text/css" rel="stylesheet" href="../../resources/css/style.css" />
	
	<f:facet name="header">
		<h:outputText value="Cadastrar País" />
	</f:facet>
	
	<h:form id="formAddPais" prependId="false" >
		<p:messages autoUpdate="true" id="messageFormPais"/>
		
		<h:panelGrid columns="1" style="padding:5px;">
			<h:outputText value="Código" />
			<p:inputText value="#{estadoBean.newPais.id}" style="width:100px;opacity:1;" disabled="true" />
		</h:panelGrid>
		
		<h:panelGrid columns="1" style="padding:5px;">
			<h:outputText value="País *" />
			<p:inputText value="#{estadoBean.newPais.pais}" required="true" requiredMessage="Informe o país." style="width:210px;" maxlength="30"/>
		</h:panelGrid>
		
		<h:panelGrid columns="2" style="padding:5px;">
			<h:outputText value="Sigla" />
			<h:outputText value="DDI" />
			
			<p:inputText value="#{estadoBean.newPais.sigla}" style="width:100px;" maxlength="3"/>
			<p:inputText value="#{estadoBean.newPais.ddi}" style="width:100px;" maxlength="2">
				<pe:keyFilter regEx="/[\d]/" />
			</p:inputText>

		</h:panelGrid>
		
		<h:panelGrid columns="1" style="padding:5px;">
			<h:outputText value="* Campos obrigatórios" />
		</h:panelGrid>	
		
		<div id="popup-buttons" style="padding-bottom: 10px;padding-right: 15px; padding-top: 10px; text-align: right;">
			<p:commandButton value="Salvar" style="height:28px;" actionListener="#{estadoBean.savePaisFromDialog}" update="formAddPais" icon="ui-icon-disk"/>
			<p:commandButton value="Cancelar" style="height:28px;" actionListener="#{estadoBean.closeDialogFormPais}" immediate="true" icon="ui-icon-cancel"/>
		</div>
	</h:form>
</p:dialog>